package liuch.ioc;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionReader;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

/**
 * 功能描述: 测试XmlBeanFactory<br>
 * 〈功能详细描述〉
 *
 * @author 17101651
 * @data 2018/6/24/024
 */
public class XmlBeanFactoryTests {
    public static void main(String[] args) {
        Resource resource = new ClassPathResource("conf/spring/beanFactoryTest.xml");
        BeanFactory fa = new DefaultListableBeanFactory();
        BeanDefinitionReader bdr = new XmlBeanDefinitionReader((BeanDefinitionRegistry) fa);
        bdr.loadBeanDefinitions(resource);

        System.out.println(fa.getBean("myTestBean").toString());
    }
}
